﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using NLog;

namespace echarts.Controllers
{
    public abstract class BaseController : ApiController
    {
        protected Logger logger;

        protected BaseController()
        {
            logger = LogManager.GetLogger(this.GetType().Name);
        }

        protected IHttpActionResult Success(string msg, object data)
        {
            return Json(new { status = 1, data, msg = msg });
        }

        protected IHttpActionResult Success(string msg)
        {
            return Json(new { status = 1, data = "", msg = msg });
        }

        protected IHttpActionResult Success(object data)
        {
            return Json(new { status = 1, data, msg = "" });
        }
        protected IHttpActionResult Failure(string msg)
        {
            return Json(new { status = 0, data = "", msg });
        }

    }
}